예제 #1
0
 def test_drop(self):
     db = DatabaseManager("otherdatabase")
     db.create_database()
     db.drop_database()
     self.cursor.execute("select SCHEMA_NAME from information_schema.SCHEMATA where SCHEMA_NAME = 'otherdatabase'")
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #2
0
 def test_create(self):
     db = DatabaseManager("newdatabase")
     db.create_database()
     self.cursor.execute("select SCHEMA_NAME from information_schema.SCHEMATA where SCHEMA_NAME = 'newdatabase'")
     row = self.cursor.fetchone()
     self.assertEqual("newdatabase", row[0])
     db.drop_database()
예제 #3
0
    def test_create_user_in_a_custom_service_host(self):
        instance = Instance.objects.create(
            name="ciclops",
            host="127.0.0.1",
            ec2_id="i-009",
            state="running",
        )
        try:
            request = RequestFactory().post("/", {"hostname": "192.168.1.1", "service_host": "127.0.0.1"})
            response = CreateUser.as_view()(request, "ciclops")
            self.assertEqual(201, response.status_code)
            content = json.loads(response.content)
            expected = {
                u"MYSQL_USER": u"ciclops",
                u"MYSQL_PASSWORD": content["MYSQL_PASSWORD"],
            }
            self.assertDictEqual(expected, content)

            self.cursor.execute("select User, Host FROM mysql.user WHERE User='******' AND Host='192.168.1.1'")
            row = self.cursor.fetchone()
            self.assertEqual("ciclops", row[0])
            self.assertEqual("192.168.1.1", row[1])
        finally:
            db = DatabaseManager("ciclops")
            db.drop_user("ciclops", "192.168.1.1")
            instance.delete()
예제 #4
0
 def test_create_user(self):
     instance = Instance.objects.create(
         name="ciclops",
         host="127.0.0.1",
         ec2_id="i-009",
         state="running",
     )
     try:
         request = RequestFactory().post("/", {"unit-host": "192.168.1.1"})
         response = CreateUser.as_view()(request, "ciclops")
         self.assertEqual(201, response.status_code)
         content = json.loads(response.content)
         expected = {
             u"MYSQL_HOST": u"127.0.0.1",
             u"MYSQL_PORT": u"3306",
             u"MYSQL_DATABASE_NAME": "ciclops",
             u"MYSQL_USER": u"ciclops",
             u"MYSQL_PASSWORD": content["MYSQL_PASSWORD"],
         }
         self.assertDictEqual(expected, content)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertEqual("ciclops", row[0])
     finally:
         db = DatabaseManager("ciclops")
         db.drop_user("ciclops", "%")
         instance.delete()
예제 #5
0
 def test_create_user_in_shared_instance_with_public_host(self):
     settings.SHARED_SERVER = "localhost"
     settings.SHARED_SERVER_PUBLIC_HOST = "10.10.10.10"
     instance = Instance.objects.create(
         name="inside_out",
         shared=True,
         state="running",
     )
     try:
         request = RequestFactory().post("/", {"unit-host": "192.168.1.10"})
         response = CreateUser.as_view()(request, "inside_out")
         self.assertEqual(201, response.status_code)
         content = json.loads(response.content)
         expected = {
             u"MYSQL_HOST": u"10.10.10.10",
             u"MYSQL_PORT": u"3306",
             u"MYSQL_DATABASE_NAME": "inside_out",
             u"MYSQL_USER": u"inside_out",
             u"MYSQL_PASSWORD": content["MYSQL_PASSWORD"],
         }
         self.assertEqual(expected, content)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertIsNotNone(row)
     finally:
         db = DatabaseManager("inside_out")
         db.drop_user("inside_out", "%")
         instance.delete()
예제 #6
0
 def test_create_user(self):
     instance = Instance.objects.create(
         name="ciclops",
         host="127.0.0.1",
         ec2_id="i-009",
         state="running",
     )
     try:
         request = RequestFactory().post("/", {"unit-host": "192.168.1.1"})
         response = CreateUser.as_view()(request, "ciclops")
         self.assertEqual(201, response.status_code)
         content = json.loads(response.content)
         expected = {
             u"MYSQL_HOST": u"127.0.0.1",
             u"MYSQL_PORT": u"3306",
             u"MYSQL_DATABASE_NAME": "ciclops",
             u"MYSQL_USER": u"ciclops",
             u"MYSQL_PASSWORD": content["MYSQL_PASSWORD"],
         }
         self.assertDictEqual(expected, content)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertEqual("ciclops", row[0])
     finally:
         db = DatabaseManager("ciclops")
         db.drop_user("ciclops", "%")
         instance.delete()
예제 #7
0
파일: views.py 프로젝트: agnhesi/mysqlapi
def drop_user(request, name, hostname):
    host = _get_service_host(request.GET)
    db = DatabaseManager(name, host)
    try:
        db.drop_user(name, hostname)
    except Exception, e:
        return HttpResponse(e[1], status=500)
예제 #8
0
 def test_drop_user(self):
     db = DatabaseManager("magneto")
     db.create_user("magneto", "localhost")
     db.drop_user("magneto", "localhost")
     self.cursor.execute("select User, Host FROM mysql.user WHERE User='******' AND Host='localhost'")
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #9
0
def export(request, name):
    host = request.GET.get("service_host", "localhost")
    try:
        db = DatabaseManager(name, host)
        return HttpResponse(db.export())
    except subprocess.CalledProcessError, e:
        return HttpResponse(e.output.split(":")[-1].strip(), status=500)
예제 #10
0
 def test_create_user_in_shared_instance_with_public_host(self):
     settings.SHARED_SERVER = "localhost"
     settings.SHARED_SERVER_PUBLIC_HOST = "10.10.10.10"
     instance = Instance.objects.create(
         name="inside_out",
         shared=True,
         state="running",
     )
     try:
         request = RequestFactory().post("/", {"unit-host": "192.168.1.10"})
         response = CreateUser.as_view()(request, "inside_out")
         self.assertEqual(201, response.status_code)
         content = json.loads(response.content)
         expected = {
             u"MYSQL_HOST": u"10.10.10.10",
             u"MYSQL_PORT": u"3306",
             u"MYSQL_DATABASE_NAME": "inside_out",
             u"MYSQL_USER": u"inside_out",
             u"MYSQL_PASSWORD": content["MYSQL_PASSWORD"],
         }
         self.assertEqual(expected, content)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertIsNotNone(row)
     finally:
         db = DatabaseManager("inside_out")
         db.drop_user("inside_out", "%")
         instance.delete()
예제 #11
0
 def test_create_user(self):
     db = DatabaseManager("wolverine")
     db.create_user("wolverine", "localhost")
     self.cursor.execute("select User, Host FROM mysql.user WHERE User='******' AND Host='localhost'")
     row = self.cursor.fetchone()
     self.assertEqual("wolverine", row[0])
     self.assertEqual("localhost", row[1])
     db.drop_user("wolverine", "localhost")
예제 #12
0
 def test_create_user_should_generate_an_username_when_username_length_is_greater_than_16(self):
     db = DatabaseManager("usernamegreaterthan16")
     username, password = db.create_user("usernamegreaterthan16", "localhost")
     self.cursor.execute("select User, Host FROM mysql.user WHERE User like 'usernamegrea%' AND Host='localhost'")
     row = self.cursor.fetchone()
     self.assertEqual("usernamegrea", row[0][:12])
     db = DatabaseManager(row[0])
     db.drop_user(username, "localhost")
예제 #13
0
 def test_create_database_with_custom_hostname(self):
     db = DatabaseManager("newdatabase", host="127.0.0.1")
     db.create_database()
     sql = "select SCHEMA_NAME from information_schema.SCHEMATA " +\
           "where SCHEMA_NAME = 'newdatabase'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("newdatabase", row[0])
     db.drop_database()
예제 #14
0
 def test_drop_user(self):
     db = DatabaseManager("magneto")
     db.create_user("magneto", "%")
     db.drop_user("magneto", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User='******' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #15
0
 def test_create__and_drop_user_username_greater_than_16_chars(self):
     db = DatabaseManager("anusernamegreaterthan16")
     db.create_user("anusernamegreaterthan16", "%")
     db.drop_user("anusernamegreaterthan16", "%")
     sql = "select User, Host FROM mysql.user " + \
         "WHERE User LIKE 'anusernamegr%' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #16
0
 def test_create_user(self):
     db = DatabaseManager("wolverine")
     db.create_user("wolverine", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User='******' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("wolverine", row[0])
     self.assertEqual("%", row[1])
     db.drop_user("wolverine", "%")
예제 #17
0
 def test_create_user_generates_username_for_dbs_grater_than_16_chars(self):
     db = DatabaseManager("usernamegreaterthan16")
     username, password = db.create_user("usernamegreaterthan16", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User like 'usernamegrea%' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("usernamegrea", row[0][:12])
     db = DatabaseManager(row[0])
     db.drop_user(username, "%")
예제 #18
0
    def test_drop_user_fom_custom_service_host(self):
        db = DatabaseManager("ciclops", "127.0.0.1")
        db.create_user("ciclops", "localhost")

        request = RequestFactory().delete("/ciclops", {"service_host": "127.0.0.1"})
        response = drop_user(request, "ciclops", "localhost")
        self.assertEqual(200, response.status_code)

        self.cursor.execute("select User, Host FROM mysql.user WHERE User='******' AND Host='localhost'")
        row = self.cursor.fetchone()
        self.assertFalse(row)
예제 #19
0
파일: views.py 프로젝트: agnhesi/mysqlapi
 def delete(self, request, name, *args, **kwargs):
     try:
         instance = Instance.objects.get(name=name)
     except Instance.DoesNotExist:
         return HttpResponse("Can't drop database 'doesnotexists'; database doesn't exist", status=500)
     self._client.terminate(instance)
     instance.delete()
     host = _get_service_host(request.GET)
     db = DatabaseManager(name, host)
     try:
         db.drop_database()
     except Exception, e:
         return HttpResponse(e[1], status=500)
예제 #20
0
 def test_create_database(self):
     try:
         request = RequestFactory().post("/", {"name": "ciclops"})
         view = CreateDatabase()
         view._client = mocks.FakeEC2Client()
         response = view.post(request)
         self.assertEqual(201, response.status_code)
         self.assertEqual("ok", response.content)
         time.sleep(0.5)
         self.cursor.execute("select SCHEMA_NAME from information_schema.SCHEMATA where SCHEMA_NAME = 'ciclops'")
         row = self.cursor.fetchone()
         self.assertEqual("ciclops", row[0])
     finally:
         db = DatabaseManager("ciclops")
         db.drop_database()
예제 #21
0
    def test_export(self):
        db = DatabaseManager("magneto")
        db.create_database()
        db.create_user("magneto", "localhost")
        self.cursor.execute("create table magneto.foo ( test varchar(255) );")
        expected = """/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `foo` (
  `test` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
"""
        result = db.export()
        self.assertEqual(expected, result.replace("InnoDB", "MyISAM"))
        db.drop_database()
        db.drop_user("magneto", "localhost")
예제 #22
0
    def test_drop_database_that_needs_name_canonicalization(self):
        settings.SHARED_SERVER = "127.0.0.1"
        canonical_name = canonicalize_db_name("xu-xu")
        Instance.objects.create(name=canonical_name, shared=True)
        db = DatabaseManager("xu-xu", settings.SHARED_SERVER)
        db.create_database()

        view = DropDatabase()
        request = RequestFactory().delete("/xu-xu")
        resp = view.delete(request, "xu-xu")
        self.assertEqual(200, resp.status_code)
        sql = "select SCHEMA_NAME from information_schema.SCHEMATA " +\
              "where SCHEMA_NAME = '{0}'"
        self.cursor.execute(sql.format(canonical_name))
        row = self.cursor.fetchone()
        self.assertIsNone(row)
예제 #23
0
 def test_drop_user_from_shared_instance(self):
     settings.SHARED_SERVER = "127.0.0.1"
     instance = Instance.objects.create(name="used", shared=True)
     try:
         db = DatabaseManager("used")
         db.create_user("used", "127.0.0.1")
         request = RequestFactory().delete("/used")
         response = drop_user(request, "used", "127.0.0.1")
         self.assertEqual(200, response.status_code)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertIsNone(row)
     finally:
         instance.delete()
예제 #24
0
 def test_unbind_app_drops_the_user_on_shared_instance(self):
     settings.SHARED_SERVER = "127.0.0.1"
     instance = Instance.objects.create(name="used", shared=True)
     try:
         db = DatabaseManager("used")
         db.create_user("used", "127.0.0.1")
         request = RequestFactory().delete("/used")
         response = BindApp.as_view()(request, "used")
         self.assertEqual(200, response.status_code)
         sql = "select User, Host FROM mysql.user " +\
               "WHERE User='******' AND Host='%'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertIsNone(row)
     finally:
         instance.delete()
예제 #25
0
    def test_drop_database_that_needs_name_canonicalization(self):
        settings.SHARED_SERVER = "127.0.0.1"
        canonical_name = canonicalize_db_name("xu-xu")
        Instance.objects.create(name=canonical_name, shared=True)
        db = DatabaseManager("xu-xu", settings.SHARED_SERVER)
        db.create_database()

        view = DropDatabase()
        request = RequestFactory().delete("/xu-xu")
        resp = view.delete(request, "xu-xu")
        self.assertEqual(200, resp.status_code)
        sql = "select SCHEMA_NAME from information_schema.SCHEMATA " +\
              "where SCHEMA_NAME = '{0}'"
        self.cursor.execute(sql.format(canonical_name))
        row = self.cursor.fetchone()
        self.assertIsNone(row)
예제 #26
0
파일: views.py 프로젝트: agnhesi/mysqlapi
 def post(self, request, name, *args, **kwargs):
     if not "hostname" in request.POST:
         return HttpResponse("Hostname is missing", status=500)
     hostname = request.POST.get("hostname", None)
     if not hostname:
         return HttpResponse("Hostname is empty", status=500)
     try:
         instance = Instance.objects.get(name=name)
     except Instance.DoesNotExist:
         return HttpResponse("Instance not found", status=404)
     if instance.state != "running":
         return HttpResponse(u"You can't bind to this instance because it's not running.", status=412)
     db = DatabaseManager(name, instance.host)
     try:
         username, password = db.create_user(name, hostname)
     except Exception, e:
         return HttpResponse(e[1], status=500)
예제 #27
0
    def test_unbind_app_drops_the_user(self):
        instance = Instance.objects.create(name="ciclops", host="127.0.0.1")
        try:
            db = DatabaseManager("ciclops")
            db.create_user("ciclops", "localhost")

            request = RequestFactory().delete("/ciclops")
            response = BindApp.as_view()(request, "ciclops")
            self.assertEqual(200, response.status_code)

            sql = "select User, Host FROM mysql.user " +\
                  "WHERE User='******' AND Host='%'"
            self.cursor.execute(sql)
            row = self.cursor.fetchone()
            self.assertFalse(row)
        finally:
            instance.delete()
예제 #28
0
 def test_init_should_canonicalize_name_property(self):
     db = DatabaseManager(
         name="foo-bar",
         host=settings.SHARED_SERVER,
         user=settings.SHARED_USER,
         password=settings.SHARED_PASSWORD,
     )
     self.assertRegexpMatches(db.name, "^foo_bar.*$")
예제 #29
0
    def test_drop_user(self):
        instance = Instance.objects.create(name="ciclops", host="127.0.0.1")
        try:
            db = DatabaseManager("ciclops")
            db.create_user("ciclops", "localhost")

            request = RequestFactory().delete("/ciclops")
            response = drop_user(request, "ciclops", "localhost")
            self.assertEqual(200, response.status_code)

            sql = "select User, Host FROM mysql.user " +\
                  "WHERE User='******' AND Host='%'"
            self.cursor.execute(sql)
            row = self.cursor.fetchone()
            self.assertFalse(row)
        finally:
            instance.delete()
예제 #30
0
    def test_export(self):
        db = DatabaseManager("magneto")
        db.create_database()
        db.create_user("magneto", "%")
        self.cursor.execute("create table magneto.foo ( test varchar(255) );")
        expected = """\
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `foo` (
  `test` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
"""
        request = RequestFactory().get("/")
        result = export(request, "magneto")
        self.assertEqual(200, result.status_code)
        self.assertEqual(expected, result.content.replace("InnoDB", "MyISAM"))
        db.drop_database()
        db.drop_user("magneto", "%")
예제 #31
0
 def test_create_database_ec2(self):
     try:
         client = mocks.FakeEC2Client()
         t = start_creator(DatabaseManager, client)
         request = RequestFactory().post("/", {"name": "ciclops"})
         view = CreateDatabase()
         view._client = client
         response = view.post(request)
         self.assertEqual(201, response.status_code)
         self.assertEqual("", response.content)
         t.stop()
         sql = "select SCHEMA_NAME from information_schema.SCHEMATA " + \
               "where SCHEMA_NAME = 'ciclops'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertEqual("ciclops", row[0])
     finally:
         db = DatabaseManager("ciclops")
         db.drop_database()
예제 #32
0
 def test_create_database_ec2(self):
     try:
         client = mocks.FakeEC2Client()
         t = start_creator(DatabaseManager, client)
         request = RequestFactory().post("/", {"name": "ciclops"})
         view = CreateDatabase()
         view._client = client
         response = view.post(request)
         self.assertEqual(201, response.status_code)
         self.assertEqual("", response.content)
         t.stop()
         sql = "select SCHEMA_NAME from information_schema.SCHEMATA " + \
               "where SCHEMA_NAME = 'ciclops'"
         self.cursor.execute(sql)
         row = self.cursor.fetchone()
         self.assertEqual("ciclops", row[0])
     finally:
         db = DatabaseManager("ciclops")
         db.drop_database()
예제 #33
0
 def test_create_user_generates_username_for_dbs_grater_than_16_chars(self):
     db = DatabaseManager("usernamegreaterthan16")
     username, password = db.create_user("usernamegreaterthan16", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User like 'usernamegrea%' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("usernamegrea", row[0][:12])
     db = DatabaseManager(row[0])
     db.drop_user(username, "%")
예제 #34
0
    def test_export_from_a_custom_service_host(self):
        db = DatabaseManager("magneto", host="127.0.0.1")
        db.create_database()
        db.create_user("magneto", "localhost")
        self.cursor.execute("create table magneto.foo ( test varchar(255) );")
        expected = """/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `foo` (
  `test` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
"""
        request = RequestFactory().get("/", {"service_host": "127.0.0.1"})
        result = export(request, "magneto")
        self.assertEqual(200, result.status_code)
        self.assertEqual(expected, result.content.replace("InnoDB", "MyISAM"))
        db.drop_database()
        db.drop_user("magneto", "localhost")
예제 #35
0
 def test_create(self):
     db = DatabaseManager("newdatabase")
     db.create_database()
     sql = "select SCHEMA_NAME from information_schema.SCHEMATA " +\
           "where SCHEMA_NAME = 'newdatabase'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("newdatabase", row[0])
     db.drop_database()
예제 #36
0
 def test_drop(self):
     db = DatabaseManager("otherdatabase")
     db.create_database()
     db.drop_database()
     sql = "select SCHEMA_NAME from information_schema.SCHEMATA where " +\
           "SCHEMA_NAME = 'otherdatabase'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #37
0
 def test_drop_user(self):
     db = DatabaseManager("magneto")
     db.create_user("magneto", "%")
     db.drop_user("magneto", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User='******' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #38
0
 def test_create__and_drop_user_username_greater_than_16_chars(self):
     db = DatabaseManager("anusernamegreaterthan16")
     db.create_user("anusernamegreaterthan16", "%")
     db.drop_user("anusernamegreaterthan16", "%")
     sql = "select User, Host FROM mysql.user " + \
         "WHERE User LIKE 'anusernamegr%' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertFalse(row)
예제 #39
0
 def test_create_user(self):
     db = DatabaseManager("wolverine")
     db.create_user("wolverine", "%")
     sql = "select User, Host FROM mysql.user " +\
           "WHERE User='******' AND Host='%'"
     self.cursor.execute(sql)
     row = self.cursor.fetchone()
     self.assertEqual("wolverine", row[0])
     self.assertEqual("%", row[1])
     db.drop_user("wolverine", "%")
예제 #40
0
 def test_public_host(self):
     db = DatabaseManager("wolverine",
                          host="localhost",
                          public_host="10.10.10.10")
     self.assertEqual(db._public_host, db.public_host)
예제 #41
0
 def test_is_up_return_True_if_everything_is_ok_with_the_connection(self):
     db = DatabaseManager("wolverine")
     self.assertTrue(db.is_up())
예제 #42
0
 def test_is_up_return_False_something_is_not_ok_with_the_connection(self):
     db = DatabaseManager("wolverine",
                          host="unknownhost.absolute.impossibru.moc")
     self.assertFalse(db.is_up())
예제 #43
0
 def create_ciclops(self):
     Instance.objects.create(name="ciclops")
     db = DatabaseManager("ciclops", "127.0.0.1")
     db.create_database()
예제 #44
0
 def test_is_up_return_True_if_everything_is_ok_with_the_connection(self):
     db = DatabaseManager("wolverine")
     self.assertTrue(db.is_up())
예제 #45
0
 def create_fandango_shared(self):
     Instance.objects.create(name="fandango", shared=True)
     db = DatabaseManager("fandango", settings.SHARED_SERVER)
     db.create_database()
예제 #46
0
 def test_is_up_return_False_something_is_not_ok_with_the_connection(self):
     db = DatabaseManager("wolverine",
                          host="unknownhost.absolute.impossibru.moc")
     self.assertFalse(db.is_up())
예제 #47
0
 def test_public_host_is_host_when_private_attribute_is_None(self):
     db = DatabaseManager("wolverine", host="localhost")
     self.assertEqual(db.host, db.public_host)
예제 #48
0
 def create_fandango_shared(self):
     Instance.objects.create(name="fandango", shared=True)
     db = DatabaseManager("fandango", settings.SHARED_SERVER)
     db.create_database()