Example #1
0
 def test_as_map(self):
     _command = json.loads(
         "{\"message\":\"Bad credentials\",\"documentation_url\":\"https://developer.github.com/v3\"}"
     )
     tbl_prop = WebHCatalog(username="******").table_properties(
         database="default", table="table")
     tbl_prop._TableProperties__get = MagicMock(return_value=_command)
     self.assertEquals(tbl_prop.properties_as_map()["message"],
                       "Bad credentials")
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_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 #4
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 #5
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 #6
0
 def test_get_all_properties(self):
     output = WebHCatalog(host=HOST, username=USER).table_properties(database="testdb",
                                                                     table="some_table").properties_as_map()["table"]
     self.assertEquals(output, "some_table")
Example #7
0
 def test_get_property(self):
     output = WebHCatalog(host=HOST, username=USER).table_properties(database="testdb",
                                                                     table="some_table").get_property("table")
     self.assertEquals(output, "some_table")
Example #8
0
 def test_as_map(self):
     _command = json.loads('{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}')
     tbl_prop = WebHCatalog(username="******").table_properties(database="default", table="table")
     tbl_prop._TableProperties__get = MagicMock(return_value=_command)
     self.assertEquals(tbl_prop.properties_as_map()["message"], "Bad credentials")