def test_non_existant_system(self):
        # add two systems: one real one and one with a hostname that doesn't
        # exist. Make sure the real one didn't get associated with the service
        # (this checks wheter we rolledback or not.)

        # a real new system
        system = create_fake_host(hostname='foobar9.mozilla.com')
        sblob, resp = self.export_services(
            'service.name="{0}"'.format(self.s1.name)
        )
        self.assertEqual(200, resp.status_code, resp.content)
        self.assertEqual(
            1, len(sblob['services']), "Should have seen only one service"
        )

        sblob['services'][0]['systems'] += [system.hostname, 'not.real.com']

        resp_json, resp = self.import_services(sblob)
        self.assertEqual(
            resp.status_code, 400, "Expected error but got: "
            "{0}".format(resp.content)
        )

        self.assertTrue(
            resp_json in 'errors', "expected to see an 'errors' key"
        )

        # The real system still sholdn't be in the service
        system = system.refresh()
        self.assertFalse(system.service_set.exists())
dataset/ETHPy150Open mozilla/inventory/core/service/tests/test_api.py/ServiceMangleAPITests.test_non_existant_system/swapped operands of `in`