Beispiel #1
0
 def test_format_dateline_to_format_when_only_city_is_present(self):
     located, formatted_date, current_ts = self._get_located_and_current_utc_ts(
     )
     formatted_dateline = format_dateline_to_locmmmddsrc(
         located, current_ts)
     self.assertEqual(
         formatted_dateline,
         'SYDNEY, %s %s -' % (formatted_date, get_default_source()))
    def test_if_no_source_defined_on_desk(self):
        desk = {'name': 'sports'}
        self.app.data.insert('desks', [desk])
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts()
        doc = {
            '_id': '123',
            'task': {
                'desk': desk['_id'],
                'stage': desk['working_stage']
            },
            'dateline': {
                'located': located,
                'date': current_ts
            }
        }

        set_default_source(doc)
        self.assertEqual(doc['source'], get_default_source())
        self.assertEqual(doc['dateline']['source'], get_default_source())
        self.assertEqual(doc['dateline']['text'], 'SYDNEY, %s %s -' % (formatted_date, get_default_source()))
Beispiel #3
0
    def test_format_dateline_to_format_when_city_state_and_country_are_present(
            self):
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts(
        )

        located['dateline'] = "city,state,country"
        formatted_dateline = format_dateline_to_locmmmddsrc(
            located, current_ts)
        self.assertEqual(
            formatted_dateline, 'SYDNEY, NSW, AU, %s %s -' %
            (formatted_date, get_default_source()))
Beispiel #4
0
    def test_if_no_source_defined_on_desk(self):
        desk = {'name': 'sports'}
        self.app.data.insert('desks', [desk])
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts()
        doc = {
            '_id': '123',
            'task': {
                'desk': desk['_id'],
                'stage': desk['working_stage']
            },
            'dateline': {
                'located': located,
                'date': current_ts
            }
        }

        set_default_source(doc)
        self.assertEqual(doc['source'], get_default_source())
        self.assertEqual(doc['dateline']['source'], get_default_source())
        self.assertEqual(doc['dateline']['text'], 'SYDNEY, %s %s -' % (formatted_date, get_default_source()))
    def test_format_dateline_to_format_when_only_city_and_country_are_present(
            self):
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts(
        )

        located["dateline"] = "city,country"
        formatted_dateline = format_dateline_to_locmmmddsrc(
            located, current_ts)
        self.assertEqual(
            formatted_dateline,
            "SYDNEY, AU, %s %s -" % (formatted_date, get_default_source()))
    def test_if_no_source_defined_on_desk(self):
        desk = {"name": "sports"}
        self.app.data.insert("desks", [desk])
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts(
        )
        doc = {
            "_id": "123",
            "task": {
                "desk": desk["_id"],
                "stage": desk["working_stage"]
            },
            "dateline": {
                "located": located,
                "date": current_ts
            },
        }

        set_default_source(doc)
        self.assertEqual(doc["source"], get_default_source())
        self.assertEqual(doc["dateline"]["source"], get_default_source())
        self.assertEqual(
            doc["dateline"]["text"],
            "SYDNEY, %s %s -" % (formatted_date, get_default_source()))
    def test_format_dateline_to_format_when_city_state_and_country_are_present(self):
        located, formatted_date, current_ts = self._get_located_and_current_utc_ts()

        located['dateline'] = "city,state,country"
        formatted_dateline = format_dateline_to_locmmmddsrc(located, current_ts)
        self.assertEqual(formatted_dateline, 'SYDNEY, NSW, AU, %s %s -' % (formatted_date, get_default_source()))
 def test_format_dateline_to_format_when_only_city_is_present(self):
     located, formatted_date, current_ts = self._get_located_and_current_utc_ts()
     formatted_dateline = format_dateline_to_locmmmddsrc(located, current_ts)
     self.assertEqual(formatted_dateline, 'SYDNEY, %s %s -' % (formatted_date, get_default_source()))