Example #1
0
 def test_options(self):
     _command = json.loads(
         "{\"k.message\":\"Bad credentials\",\"documentation_url\":\"https://developer.github.com/v3\"}"
     )
     tbl_prop = TableProperties(database="default",
                                table="table",
                                webhcat=WebHCatalog(username="******"))
     tbl_prop._TableProperties__get = MagicMock(return_value=_command)
     self.assertEquals(tbl_prop._options(section="k"), ["message"])
Example #2
0
 def test_put_property(self):
     tbl_prop = TableProperties(database="default",
                                table="table",
                                webhcat=WebHCatalog(username="******"))
     tbl_prop._TableProperties__put = MagicMock(return_value=True)
     self.assertTrue(tbl_prop.set_property("message"))
     tbl_prop._TableProperties__put = MagicMock(return_value=False)
     self.assertFalse(tbl_prop.set_property("message"))
Example #3
0
 def test_set(self):
     _command = json.loads(
         "{\"k.message\":\"Bad credentials\",\"documentation_url\":\"https://developer.github.com/v3\"}"
     )
     tbl_prop = TableProperties(database="default",
                                table="table",
                                webhcat=WebHCatalog(username="******"))
     tbl_prop._TableProperties__get = MagicMock(return_value=_command)
     tbl_prop._set(section="mys", key="myk", value="myv")
     self.assertTrue(tbl_prop._has_option("mys", "myk"))
Example #4
0
 def test_put_property(self):
     w = WebHCatalog(host=HOST, username=USER)
     result = TableProperties(database="testdb", table="some_table", webhcat=w).set_property("my")
     self.assertTrue(result)
Example #5
0
 def test_put_property(self):
     tbl_prop = TableProperties(database="default", table="table", webhcat=WebHCatalog(username="******"))
     tbl_prop._TableProperties__put = MagicMock(return_value=True)
     self.assertTrue(tbl_prop.set_property("message"))
     tbl_prop._TableProperties__put = MagicMock(return_value=False)
     self.assertFalse(tbl_prop.set_property("message"))
Example #6
0
 def test_get(self):
     _command = json.loads('{"k.message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}')
     tbl_prop = TableProperties(database="default", table="table", webhcat=WebHCatalog(username="******"))
     tbl_prop._TableProperties__get = MagicMock(return_value=_command)
     self.assertEquals(tbl_prop._get(section="k", key="message"), "Bad credentials")