def test_osm_xml_file_generated_correctly(self, mock_task):
        if self.skip_tests:
            return

        # Arrange
        task = Task.get(1, self.test_project.id)
        mock_task.return_value = [task]

        # Act
        osm_xml = MappingService.generate_osm_xml(1, '1,2')

        # Covert XML into a hash that should be identical every time
        osm_xml_str = osm_xml.decode('utf-8')
        osm_hash = hashlib.md5(osm_xml_str.encode('utf-8')).hexdigest()

        # Assert
        self.assertEqual(osm_hash, 'eafd0760a0d372e2ab139e25a2d300f1')
예제 #2
0
    def test_gpx_xml_file_generated_correctly(self, mock_task):
        if self.skip_tests:
            return

        # Arrange
        task = Task.get(1, self.test_project.id)
        mock_task.return_value = [task]

        # Act
        osm_xml = MappingService.generate_osm_xml(1, '1,2')

        # Covert XML into a hash that should be identical every time
        osm_xml_str = osm_xml.decode('utf-8')
        osm_hash = hashlib.md5(osm_xml_str.encode('utf-8')).hexdigest()

        # Assert
        self.assertEqual(osm_hash, '76c8cebb99729481d46734463386bad3')
    def test_gpx_xml_file_generated_correctly(self, mock_task):
        if self.skip_tests:
            return

        # Arrange
        task = Task.get(1, self.test_project.id)
        mock_task.return_value = [task]
        timestamp = datetime.date(2017, 4, 13)

        # Act
        gpx_xml = MappingService.generate_gpx(1, '1,2', timestamp)

        # Covert XML into a hash that should be identical every time
        gpx_xml_str = gpx_xml.decode('utf-8')
        gpx_hash = hashlib.md5(gpx_xml_str.encode('utf-8')).hexdigest()

        # Assert
        self.assertEqual(gpx_hash, '97c4274c013964091974916ffee07846')
    def test_gpx_xml_file_generated_correctly_all_tasks(self, mock_task):
        if self.skip_tests:
            return

        # Arrange
        task = Task.get(1, self.test_project.id)
        mock_task.return_value = [task]
        timestamp = datetime.date(2017, 4, 13)

        # Act
        gpx_xml = MappingService.generate_gpx(1, None, timestamp)

        # Convert XML into a hash that should be identical every time
        gpx_xml_str = gpx_xml.decode('utf-8')
        gpx_hash = hashlib.md5(gpx_xml_str.encode('utf-8')).hexdigest()

        # Assert
        self.assertEqual(gpx_hash, 'b91f7361cc1d6d9433cf393609103272')
예제 #5
0
    def test_osm_xml_file_generated_correctly_all_tasks(self, mock_task):
        if self.skip_tests:
            return

        # Arrange
        task = Task.get(1, self.test_project.id)
        mock_task.return_value = [task]

        # Act
        osm_xml = MappingService.generate_osm_xml(1, None)

        # Convert XML into a hash that should be identical every time
        osm_xml_str = osm_xml.decode('utf-8')
        osm_hash = hashlib.md5(osm_xml_str.encode('utf-8')).hexdigest()
        f = open('/home/enelson/test.xml', 'w')
        f.write(osm_xml_str)
        f.close()

        # Assert
        self.assertEqual(osm_hash, 'eafd0760a0d372e2ab139e25a2d300f1')