Esempio n. 1
0
def __list():
    result = sheet.get_values(INDEX_RANGE)
    values = result.get('values', [])

    if not values:
        return []

    return [IndexRecord.build(value) for value in values]
Esempio n. 2
0
    def test_update_indexes(self):
        indexes = [
            IndexRecord.build(row)
            for row in self.load_fixture('fixtures/sheet_indexes.json')
        ]
        self.repo.update_indexes(indexes)
        results = self.repo.list_indexes()

        for result in results:
            self.assertTrue(result in indexes)
Esempio n. 3
0
    def test_update_securities(self):
        index = IndexRecord.build(
            self.load_fixture('fixtures/sheet_indexes.json')[0])
        securities = [
            SecurityRecord.build(row, index)
            for row in self.__get_securities()
        ]
        security_indexes = [
            SecurityIndexRecord.build(security, index)
            for security in securities
        ]
        self.repo.update_securities(securities)
        self.repo.update_security_indexes(security_indexes)
        results = self.repo.list_securities(index=index)

        for result in results:
            self.assertTrue(result in securities)
Esempio n. 4
0
 def test_update_index(self):
     fixture = next(iter(self.load_fixture('fixtures/sheet_indexes.json')))
     index = IndexRecord.build(fixture)
     self.repo.update_index(index)
     result = self.repo.get_index(index.code)
     self.assertTrue(result == index)