add test for metadata parsing based on a parse output to a pickle

This is a test to cover future modifications of the .txt metadata parsing.
The pickle file was generated by just dumping the current parsed metadata,
so this test will always succeed if the parsing is not changed.
This commit is contained in:
Hans-Christoph Steiner 2015-07-22 01:16:43 -07:00
parent eeb8ba02b0
commit 1bbae4cd9e
3 changed files with 934 additions and 0 deletions

54
tests/metadata.TestCase Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# http://www.drdobbs.com/testing/unit-testing-with-python/240165163
import inspect
import optparse
import os
import pickle
import sys
import unittest
localmodule = os.path.realpath(
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
print('localmodule: ' + localmodule)
if localmodule not in sys.path:
sys.path.insert(0, localmodule)
import fdroidserver.common
import fdroidserver.metadata
class MetadataTest(unittest.TestCase):
'''fdroidserver/metadata.py'''
def test_read_metadata(self):
testsdir = os.path.dirname(__file__)
os.chdir(testsdir)
self.maxDiff = None
# these only need to be set to prevent code running on None. The
# values are not used in metadata.py
config = dict()
config['sdk_path'] = '/opt/android-sdk'
config['ndk_paths'] = dict()
fdroidserver.common.config = config
apps = fdroidserver.metadata.read_metadata(xref=True)
for appid in ('org.smssecure.smssecure', 'org.adaway'):
frompickle = pickle.load(open(os.path.join('metadata', appid + '.pickle')))
self.assertTrue(appid in apps.keys())
self.assertEquals(apps[appid], frompickle)
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
(fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
newSuite = unittest.TestSuite()
newSuite.addTest(unittest.makeSuite(MetadataTest))
unittest.main()

View File

@ -0,0 +1,755 @@
(dp0
S'Update Check Data'
p1
NsS'Bitcoin'
p2
NsS'AntiFeatures'
p3
NsS'Web Site'
p4
S'http://www.smssecure.org'
p5
sS'Auto Update Mode'
p6
S'Version v%v'
p7
sS'Provides'
p8
NsS'Issue Tracker'
p9
S'https://github.com/SMSSecure/SMSSecure/issues'
p10
sS'Donate'
p11
NsS'Repo Type'
p12
S'git'
p13
sS'Description'
p14
(lp15
S'SMSSecure is an SMS/MMS application that allows you to protect your privacy while communicating with friends.'
p16
aS'Using SMSSecure, you can send SMS messages and share media or attachments with complete privacy.'
p17
aS''
p18
aS"* Easy. SMSSecure works like any other SMS application. There's nothing to sign up for and no new service your friends need to join."
p19
aS'* Reliable. SMSSecure communicates using encrypted SMS messages. No servers or internet connection required.'
p20
aS'* Private. SMSSecure uses the TextSecure encryption protocol to provide privacy for every message, every time.'
p21
aS'* Safe. All messages are encrypted locally, so if your phone is lost or stolen, your messages are protected.'
p22
aS'* Open Source. SMSSecure is Free and Open Source, enabling anyone to verify its security by auditing the code.'
p23
asS'Requires Root'
p24
I00
sS'comments'
p25
(lp26
sS'id'
p27
S'org.smssecure.smssecure'
p28
sS'Repo'
p29
S'https://github.com/SMSSecure/SMSSecure'
p30
sS'No Source Since'
p31
g18
sS'Auto Name'
p32
S'SMSSecure'
p33
sS'Categories'
p34
(lp35
S'Phone & SMS'
p36
asS'Source Code'
p37
S'https://github.com/SMSSecure/SMSSecure'
p38
sS'Litecoin'
p39
NsS'Update Check Ignore'
p40
NsS'Name'
p41
NsS'License'
p42
S'GPLv3'
p43
sS'Changelog'
p44
g18
sS'Update Check Mode'
p45
S'Tags'
p46
sS'Summary'
p47
S'Send encrypted text messages (SMS)'
p48
sS'Dogecoin'
p49
NsS'Maintainer Notes'
p50
(lp51
sS'Current Version Code'
p52
S'102'
p53
sS'Binaries'
p54
NsS'Archive Policy'
p55
NsS'builds'
p56
(lp57
(dp58
S'submodules'
p59
I00
sS'vercode'
p60
S'5'
p61
sS'forceversion'
p62
I00
sS'oldsdkloc'
p63
I00
sS'kivy'
p64
I00
sS'patch'
p65
(lp66
sS'scanignore'
p67
(lp68
sS'srclibs'
p69
(lp70
S'GradleWitness@10f1269c0aafdc1d478efc005ed48f3a47d44278'
p71
aS'PreferenceFragment@717a45433b927d2f0dfc5328f79e77c9682c37bc'
p72
aS'ShortcutBadger@3815ce2ec0c66acd7d7c0b4f2479df8fa70fed87'
p73
aS'AospMms@android-5.1.0_r3'
p74
asS'encoding'
p75
NsS'extlibs'
p76
(lp77
sS'init'
p78
g18
sS'version'
p79
S'0.3.3'
p80
sS'subdir'
p81
NsS'rm'
p82
(lp83
S'libs/*'
p84
asS'type'
p85
S'gradle'
p86
sS'build'
p87
g18
sS'ndk_path'
p88
g18
sS'forcevercode'
p89
I01
sS'preassemble'
p90
(lp91
sS'update'
p92
(lp93
S'auto'
p94
asS'maven'
p95
I00
sS'disable'
p96
S'builds, merge changes into upstream'
p97
sS'commit'
p98
S'66367479a4f57f347b5cbe8f6f8f632adaae7727'
p99
sS'scandelete'
p100
(lp101
sS'buildjni'
p102
(lp103
sS'ndk'
p104
S'r10e'
p105
sS'target'
p106
NsS'antcommands'
p107
NsS'gradle'
p108
(lp109
S'yes'
p110
asS'prebuild'
p111
S"touch signing.properties && pushd $$GradleWitness$$ && gradle jar && popd && cp $$GradleWitness$$/build/libs/GradleWitness.jar libs/gradle-witness.jar && sed -i -e '20,22d' build.gradle && pushd $$PreferenceFragment$$ && gradle uploadArchives && popd && sed -i -e '/5470f5872514a6226fa1fc6f4e000991f38805691c534cf0bd2778911fc773ad/d' build.gradle && mkdir smil && pushd smil && wget -c http://www.w3.org/TR/smil-boston-dom/java-binding.zip && unzip java-binding.zip && popd && cp -fR smil/java/org src/ && rm -fR smil && sed -i -e '/org.w3c.smil/d' build.gradle && cp -fR $$AospMms$$/src/org src/ "
p112
sS'novcheck'
p113
I00
sS'output'
p114
Nsa(dp115
S'submodules'
p116
I01
sg60
S'6'
p117
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sS'srclibs'
p118
(lp119
S'GradleWitness@10f1269c0aafdc1d478efc005ed48f3a47d44278'
p120
asg75
Nsg76
g77
sg78
g18
sg79
S'0.3.3'
p121
sg81
NsS'rm'
p122
(lp123
S'libs/*.jar'
p124
asg85
g86
sg87
g18
sg88
g18
sS'forcevercode'
p125
I00
sg90
g91
sg92
g93
sg95
I00
sS'disable'
p126
S'builds, wait for upstream'
p127
sS'commit'
p128
S'9675ce5eecb929dcaddb43b3d9486fdb88b9ae1a'
p129
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p130
(lp131
g110
asS'prebuild'
p132
S'touch signing.properties && pushd $$GradleWitness$$ && gradle jar && popd && cp $$GradleWitness$$/build/libs/GradleWitness.jar libs/gradle-witness.jar'
p133
sg113
I00
sg114
Nsa(dp134
S'submodules'
p135
I01
sg60
S'9'
p136
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sS'srclibs'
p137
(lp138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.4.2'
p139
sg81
NsS'rm'
p140
(lp141
S'libs/*.jar'
p142
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sS'disable'
p143
S'builds locally, but not on BS'
p144
sS'commit'
p145
S'v0.4.2'
p146
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p147
(lp148
g110
asS'prebuild'
p149
S'touch signing.properties && ./build-witness.sh && rm -rf libs/gradle-witness/build && echo "org.gradle.jvmargs=-Xms512m -Xmx512m -XX:MaxPermSize=512m" >> gradle.properties'
p150
sg113
I00
sg114
Nsa(dp151
S'submodules'
p152
I01
sg60
S'11'
p153
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sg137
g138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.5.1'
p154
sg81
NsS'rm'
p155
(lp156
S'libs/*.jar'
p157
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sS'disable'
p158
I00
sS'commit'
p159
S'v0.5.1'
p160
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p161
(lp162
g110
asS'prebuild'
p163
S'touch signing.properties && ./build-witness.sh && rm -rf libs/gradle-witness/build && echo "org.gradle.jvmargs=-Xms512m -Xmx512m -XX:MaxPermSize=512m" >> gradle.properties'
p164
sg113
I00
sg114
Nsa(dp165
S'submodules'
p166
I01
sg60
S'12'
p167
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sg137
g138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.5.2'
p168
sg81
NsS'rm'
p169
(lp170
S'libs/*.jar'
p171
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sS'disable'
p172
S'broken in upstream'
p173
sS'commit'
p174
S'v0.5.2'
p175
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p176
(lp177
g110
asS'prebuild'
p178
S'touch signing.properties && ./scripts/build-witness.sh && rm -rf libs/gradle-witness/build'
p179
sg113
I00
sg114
Nsa(dp180
S'submodules'
p181
I01
sg60
S'100'
p182
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sg137
g138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.5.3'
p183
sg81
NsS'rm'
p184
(lp185
S'libs/*.jar'
p186
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sg158
I00
sS'commit'
p187
S'v0.5.3'
p188
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p189
(lp190
g110
asS'prebuild'
p191
S'touch signing.properties && ./scripts/build-witness.sh && rm -rf libs/gradle-witness/build'
p192
sg113
I00
sg114
Nsa(dp193
S'submodules'
p194
I01
sg60
S'101'
p195
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sg137
g138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.5.4'
p196
sg81
NsS'rm'
p197
(lp198
S'libs/*.jar'
p199
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sg158
I00
sS'commit'
p200
S'v0.5.4'
p201
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p202
(lp203
g110
asS'prebuild'
p204
S'touch signing.properties && ./scripts/build-witness.sh && rm -rf libs/gradle-witness/build'
p205
sg113
I00
sg114
Nsa(dp206
S'submodules'
p207
I01
sg60
S'102'
p208
sg62
I00
sg63
I00
sg64
I00
sg65
g66
sg67
g68
sg137
g138
sg75
Nsg76
g77
sg78
g18
sg79
S'0.6.0'
p209
sg81
NsS'rm'
p210
(lp211
S'libs/*.jar'
p212
asg85
g86
sg87
g18
sg88
g18
sg125
I00
sg90
g91
sg92
g93
sg95
I00
sg158
I00
sS'commit'
p213
S'v0.6.0'
p214
sg100
g101
sg102
g103
sg104
g105
sg106
Nsg107
NsS'gradle'
p215
(lp216
g110
asS'prebuild'
p217
S'touch signing.properties && ./scripts/build-witness.sh && rm -rf libs/gradle-witness/build'
p218
sg113
I00
sg114
NsasS'FlattrID'
p219
NsS'Disabled'
p220
NsS'Update Check Name'
p221
NsS'Vercode Operation'
p222
NsS'Current Version'
p223
S'0.6.0'
p224
s.

View File

@ -0,0 +1,125 @@
Categories:Phone & SMS
License:GPLv3
Web Site:http://www.smssecure.org
Source Code:https://github.com/SMSSecure/SMSSecure
Issue Tracker:https://github.com/SMSSecure/SMSSecure/issues
Auto Name:SMSSecure
Summary:Send encrypted text messages (SMS)
Description:
SMSSecure is an SMS/MMS application that allows you to protect your privacy while communicating with friends.
Using SMSSecure, you can send SMS messages and share media or attachments with complete privacy.
* Easy. SMSSecure works like any other SMS application. There's nothing to sign up for and no new service your friends need to join.
* Reliable. SMSSecure communicates using encrypted SMS messages. No servers or internet connection required.
* Private. SMSSecure uses the TextSecure encryption protocol to provide privacy for every message, every time.
* Safe. All messages are encrypted locally, so if your phone is lost or stolen, your messages are protected.
* Open Source. SMSSecure is Free and Open Source, enabling anyone to verify its security by auditing the code.
.
Repo Type:git
Repo:https://github.com/SMSSecure/SMSSecure
Build:0.3.3,5
disable=builds, merge changes into upstream
commit=66367479a4f57f347b5cbe8f6f8f632adaae7727
gradle=yes
srclibs=GradleWitness@10f1269c0aafdc1d478efc005ed48f3a47d44278,PreferenceFragment@717a45433b927d2f0dfc5328f79e77c9682c37bc,ShortcutBadger@3815ce2ec0c66acd7d7c0b4f2479df8fa70fed87,AospMms@android-5.1.0_r3
forcevercode=yes
rm=libs/*
prebuild=touch signing.properties && \
pushd $$GradleWitness$$ && \
gradle jar && \
popd && \
cp $$GradleWitness$$/build/libs/GradleWitness.jar libs/gradle-witness.jar && \
sed -i -e '20,22d' build.gradle && \
pushd $$PreferenceFragment$$ && \
gradle uploadArchives && \
popd && \
sed -i -e '/5470f5872514a6226fa1fc6f4e000991f38805691c534cf0bd2778911fc773ad/d' build.gradle && \
mkdir smil && \
pushd smil && \
wget -c http://www.w3.org/TR/smil-boston-dom/java-binding.zip && \
unzip java-binding.zip && \
popd && \
cp -fR smil/java/org src/ && \
rm -fR smil && \
sed -i -e '/org.w3c.smil/d' build.gradle && \
cp -fR $$AospMms$$/src/org src/
Build:0.3.3,6
disable=builds, wait for upstream
commit=9675ce5eecb929dcaddb43b3d9486fdb88b9ae1a
submodules=yes
gradle=yes
srclibs=GradleWitness@10f1269c0aafdc1d478efc005ed48f3a47d44278
rm=libs/*.jar
prebuild=touch signing.properties && \
pushd $$GradleWitness$$ && \
gradle jar && \
popd && \
cp $$GradleWitness$$/build/libs/GradleWitness.jar libs/gradle-witness.jar
Build:0.4.2,9
disable=builds locally, but not on BS
commit=v0.4.2
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./build-witness.sh && \
rm -rf libs/gradle-witness/build && \
echo "org.gradle.jvmargs=-Xms512m -Xmx512m -XX:MaxPermSize=512m" >> gradle.properties
Build:0.5.1,11
commit=v0.5.1
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./build-witness.sh && \
rm -rf libs/gradle-witness/build && \
echo "org.gradle.jvmargs=-Xms512m -Xmx512m -XX:MaxPermSize=512m" >> gradle.properties
Build:0.5.2,12
disable=broken in upstream
commit=v0.5.2
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./scripts/build-witness.sh && \
rm -rf libs/gradle-witness/build
Build:0.5.3,100
commit=v0.5.3
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./scripts/build-witness.sh && \
rm -rf libs/gradle-witness/build
Build:0.5.4,101
commit=v0.5.4
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./scripts/build-witness.sh && \
rm -rf libs/gradle-witness/build
Build:0.6.0,102
commit=v0.6.0
submodules=yes
gradle=yes
rm=libs/*.jar
prebuild=touch signing.properties && \
./scripts/build-witness.sh && \
rm -rf libs/gradle-witness/build
Auto Update Mode:Version v%v
Update Check Mode:Tags
Current Version:0.6.0
Current Version Code:102